package com.xiyun.f1501t1600;

import java.util.Arrays;

public class ArithProgression_1502 {
    public static boolean resolve() {
        int[] arr = new int[]{1,2,4};
        return new Solution().canMakeArithmeticProgression(arr);
    }
}

class Solution {
    public boolean canMakeArithmeticProgression(int[] arr) {
        if (arr.length == 2) {
            return true;
        }
        Arrays.sort(arr);
        int diff = arr[1] - arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] - arr[i - 1] != diff) {
                return false;
            }
        }
        return true;
    }
}
